<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hello</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
    <template id="header">
        <header>
            标题 - {{ msg }}
            <button @click="add">{{count}}</button>
        </header>
    </template>
    <my-header></my-header>
    <my-header></my-header>
    <my-header></my-header>
</div>
<script>
    Vue.component("my-header", {
        template: `#header`,
        data(){
            return {
                msg: "hello component",
                count: 0,
            }
        },
        methods:{
            add(){
                this.count++;
            }
        }
    });
    new Vue().$mount("#app");
</script>
</body>
</html>